package com.wanyangproject.androidlearning.designMode.strategy;

public abstract class Duck {

    private Fly fly;
    private Tweet tweet;

    abstract void display();

    abstract void name();


    public void setFly(Fly fly) {
        this.fly = fly;
    }

    public void setTweet(Tweet tweet) {
        this.tweet = tweet;
    }

    public void fly() {
        if (fly != null) {
            fly.isFlying();
        }
    }

    public void tweet() {
        if (tweet != null) {
            tweet.isTweeting();
        }
    }

}
